import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer, Text
import MySQLdb


engine = create_engine("mysql+mysqldb://root@localhost:3306/mysql")
Base = declarative_base()

class help_topic(Base):
    __tablename__ = "help_topic"
    help_topic_id = Column(Integer, primary_key=True)
    name = Column(String, nullable=False, index=True)
    help_catagory_id = Column(Integer, nullable=False, index=True)
    description = Column(Text, nullable=False, index=True)
    example = Column(Text, nullable=False, index=True)
    url = Column(Text, nullable=False, index=True)

    def __repr__(self):
        return '%s(%r)' % (self.__class__.__name__, self.help_topic_id)

app = QApplication(sys.argv)

db = MySQLdb.connect("localhost", "root", "qaz123456", "mysql", charset='utf8' )
cursor = db.cursor()
cursor.execute("show tables")
results = cursor.fetchall()
list = QListWidget()
for row in results:
    list.addItem(row[0])
list.setSelectionMode(QAbstractItemView.ExtendedSelection)
list.setCurrentRow(0)
list.show()
db.close()
sys.exit(app.exec_())